Ext.onReady(function (){
   var formPanel= new Ext.form.FormPanel({
      renderTo:'addMenu',
      frame : true,
       height : 200,
       width : 300,
       margins:'3 0 3 3',
       cmargins:'3 3 3 3',
       bodyStyle:'padding:5px 5px 0',
      layout : 'form',
      labelWidth :65,
      labelAlign:"right",
      defaultType:"textfield",
      items:[
      { fieldLabel : '菜单名',
         name:"menuName",
         allowBlank:false,
         minLength : 2,
         minLengthText : "长度不能小于2个字符",
         maxLength : 10,
         maxLengthText : "长度超过了10个字符"
         
       },
        { fieldLabel : '菜单路径',
         name:"menuUrl",
         allowBlank:false 
       },
        { fieldLabel : '菜单说明',
          width:200,
         name:"menuDescribe"
         
       }
      
      ],
     buttons: [{
            text: '提交',
            handler: function(){
                if(formPanel.form.isValid()) {
                   
                    formPanel.getForm().submit({
                        
                        url: 'studentServlet?cmd=add',
                        method: 'POST',
                        waitTitle: '请稍等……', 
                        waitMsg: '正在上传数据……',  
                        success: function() {
                            Ext.Msg.alert("成功", "操作成功！");
                           
                        },
                        failure: function() {
                            Ext.Msg.alert("出错啦", "数据保存失败！");
                            
                        }
                    });
                   
                }
            }
        }, {
            text: '重置',
            handler: function() {
               
                formPanel.form.reset();
            }
        }]
       
       }
      
      )

});

